<script type="text/javascript">
	

    function ajaxFilterDistrict(city_id)
    {
        $.ajax({
        url: '<?php echo $this->Html->url(array("controller" => "districts", "action" => "ajaxDistrictOption", "admin" => false));?>/'+city_id,        
        success: function( data ) {
            if (console && console.log){
              $("#NewproductDistrictId").html(data);
	      //alert($("#ProductDistrictId").val());
	      //ajaxFilterProject($("#ProductDistrictId").val());
            }
          }
        });
    }
    
    function ajaxFilterCareer(city_id)
    {
        $.ajax({
        url: '<?php echo $this->Html->url(array("controller" => "careers", "action" => "ajaxCareerOption", "admin" => false));?>/'+city_id,        
        success: function( data ) {
            if (console && console.log){
              $("#NewproductCareerId").html(data);
	      //alert($("#ProductDistrictId").val());
	      //ajaxFilterProject($("#ProductDistrictId").val());
            }
          }
        });
    }

</script>

<div class="newproducts form">
<?php echo $this->Form->create('Newproduct', array('type' => 'file'));?>
	<fieldset>
		<legend><?php __('Admin Add Newproduct'); ?></legend>
	<?php
		echo $this->Form->input('user_id');
		echo $this->Form->input('city_id', array("onchange"=>"ajaxFilterDistrict(this.value);ajaxFilterCareer(this.value);", 'label'=>'Tỉnh/Thành'));
		echo $this->Form->input('district_id');
		echo $this->Form->input('career_id');
		echo $this->Form->input('name');
		echo $this->Form->input('hit');
		echo $this->Form->input('price');
		echo $this->Form->input('short_description');
		echo $this->Form->input('description');
		echo $this->Form->input('nsx');
		echo $this->Form->input('ncc');
		echo $this->Form->input('create_date');
	?>
					<div class="input file">
						<label for="NewproductImageFilename">Tập tin ảnh</label>
						<input type="file" id="NewproductImageFilename" name="data[NewproductImage][0][filename]">
					</div>
					<input type="hidden" id="NewproductImageDir" name="data[NewproductImage][0][dir]" />
					<input type="hidden" id="NewproductImageMimetype" name="data[NewproductImage][0][mimetype]" />
					<input type="hidden" id="NewproductImageFilesize" name="data[NewproductImage][0][filesize]" />
					
					<div class="input file">
						<label for="NewproductImageFilename">Tập tin ảnh</label>
						<input type="file" id="NewproductImageFilename" name="data[NewproductImage][1][filename]">
					</div>
					<input type="hidden" id="NewproductImageDir" name="data[NewproductImage][1][dir]" />
					<input type="hidden" id="NewproductImageMimetype" name="data[NewproductImage][1][mimetype]" />
					<input type="hidden" id="NewproductImageFilesize" name="data[NewproductImage][1][filesize]" />
					
					<div class="input file">
						<label for="NewproductImageFilename">Tập tin ảnh</label>
						<input type="file" id="NewproductImageFilename" name="data[NewproductImage][2][filename]">
					</div>
					<input type="hidden" id="NewproductImageDir" name="data[NewproductImage][2][dir]" />
					<input type="hidden" id="NewproductImageMimetype" name="data[NewproductImage][2][mimetype]" />
					<input type="hidden" id="NewproductImageFilesize" name="data[NewproductImage][2][filesize]" />	
	
	
	</fieldset>
<?php echo $this->Form->end(__('Submit', true));?>
</div>
<div class="actions">
	<h3><?php __('Actions'); ?></h3>
	<ul>

		<li><?php echo $this->Html->link(__('List Newproducts', true), array('action' => 'index'));?></li>
		<li><?php echo $this->Html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Cities', true), array('controller' => 'cities', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New City', true), array('controller' => 'cities', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Districts', true), array('controller' => 'districts', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New District', true), array('controller' => 'districts', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Careers', true), array('controller' => 'careers', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Career', true), array('controller' => 'careers', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Newproduct Images', true), array('controller' => 'newproduct_images', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Newproduct Image', true), array('controller' => 'newproduct_images', 'action' => 'add')); ?> </li>
	</ul>
</div>